Skip to content

Commit 6f09513

Browse files
committed
formatting
1 parent 9a7564b commit 6f09513

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/file_cache.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@ impl<T: AsyncFromStrWithState> FileCache<T> {
100100
pub async fn get(&self, app_state: &AppState, path: &PathBuf) -> anyhow::Result<Arc<T>> {
101101
self.get_with_privilege(app_state, path, true).await
102102
}
103-
103+
104104
/// Gets a file from the cache, or loads it from the file system if it's not there
105105
/// The privileged parameter is used to determine whether the access should be denied
106106
/// if the file is in the sqlpage/ config directory
107-
pub async fn get_with_privilege(&self, app_state: &AppState, path: &PathBuf, privileged: bool) -> anyhow::Result<Arc<T>> {
107+
pub async fn get_with_privilege(
108+
&self,
109+
app_state: &AppState,
110+
path: &PathBuf,
111+
privileged: bool,
112+
) -> anyhow::Result<Arc<T>> {
108113
log::trace!("Attempting to get from cache {:?}", path);
109114
if let Some(cached) = self.cache.read().await.get(path) {
110115
if app_state.config.environment.is_prod() && !cached.needs_check() {

src/webserver/database/connect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use sqlx::{
1313
impl Database {
1414
pub async fn init(config: &AppConfig) -> anyhow::Result<Self> {
1515
let database_url = &config.database_url;
16-
let mut connect_options: AnyConnectOptions =
17-
database_url
16+
let mut connect_options: AnyConnectOptions = database_url
1817
.parse()
1918
.with_context(|| format!("{database_url:?} is not a valid database URL"))?;
2019
connect_options.log_statements(log::LevelFilter::Trace);

tests/index.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ async fn test_csv_upload() -> actix_web::Result<()> {
188188
/// `/sqlpage/migrations/0001_init.sql` should return a 403 Forbidden
189189
async fn privileged_paths_are_not_accessible() {
190190
let resp_result = req_path("/sqlpage/migrations/0001_init.sql").await;
191-
assert!(resp_result.is_err(), "Accessing a migration file should be forbidden");
191+
assert!(
192+
resp_result.is_err(),
193+
"Accessing a migration file should be forbidden"
194+
);
192195
let resp = resp_result.unwrap_err().error_response();
193196
assert_eq!(resp.status(), http::StatusCode::FORBIDDEN);
194197
assert!(

0 commit comments

Comments
 (0)