Skip Navigation
What would you consider your threat model?
  • I used reddit under a normal username that I used everywhere for like 10 years. I didn't ever do anything, but did start to feel uncomfortable with the amount of data available to anyone interested. Discord was so much worse for me, I had years of chat logs with like thousands and thousands of messages. Modern governments have the potential to have so much information on people compared to before 1970. Like, there's a very big difference between getting a subponea for 100,000 messages in chat logs for 2010-2020 and having to talk to acquaintances of the person in the ways that investigations happened before the internet.

    I don't know, I somewhat think there should be shorter time limits for how long chat logs can be used in courts.

  • What would you consider your threat model?
  • My threat model is company tracking. I feel like I stand out like a bright red target with a random letter username, but it's just so companies using tools like Sherlock will struggle to connect my other accounts. I found it exhausting to create new usernames that I liked for every service.

    I've actually been wanting to create a normal fediverse account self hosted with my own domain, but I haven't done it yet because I haven't completely determined what I want to do yet.

  • Allow argument in macro to be Option<T> or T
  • I had commented something similar to stating it was possible to pass the inference problem to the struct if the goal was to support more types, but I removed it because I didn't think my example was easy to understand when reading it later. I made a better example though

    https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8651fa6121840658b4b6249399f693c7

  • Allow argument in macro to be Option<T> or T
  • I made an edit.

    There's not anything stopping it from supporting Option<&str> though. This would be the implementation

    impl OptionUpgrade for Option<&str> {
        fn upgrade(self) -> Option<String> {
            self.map(|v| v.into())
        }
    }
    

    It's also possible to just make it generic over Option types

    impl<A: ToString> OptionUpgrade for Option<A> {
        fn upgrade(self) -> Option<String> {
            self.map(|v| v.to_string())
        }
    }
    
  • Allow argument in macro to be Option<T> or T
  • Two of your macro rules are not used 😉 (expand to see which ones).

    The macro rules are all used. (Macros are matched from top to bottom by the declared match types. The ident/expressions can't match until after the more text based Option matching.)

    let _foo = Span { line: 1, column: 1, file_path: None };
    let _bar = Span { line: 1, column: 1, file_path: "file.txt".upgrade() };
    let _baz = Span { line: 1, column: 1, file_path: Some("file.txt".to_string()) };
    let _baz = Span { line: 1, column: 1, file_path: None };
    let _baz = Span { line: 1, column: 1, file_path: borrowed.upgrade() };
    let _baz = Span { line: 1, column: 1, file_path: owned.upgrade() };
    

    This doesn’t support Option<&str>. If it did, we would lose literal None support 😉

    I didn't make Option<&str> an option because the struct is for type Option<String>. It does support Option<String> though.

    impl OptionUpgrade for Option<String> {
        fn upgrade(self) -> Option<String> {
            self
        }
    }
    

    It looks like the following, and uses the last match case.

    let opt: Option<String> = Some("text".into());
    let opt = span!(1, 1, opt);
    

    With macro expansion

    let opt: Option<String> = Some("text".into());
    let opt = Span { line: 1, column: 1, file_path: opt.upgrade() };
    

    There's not anything stopping it from supporting Option<&str> though. This would be the implementation

    impl OptionUpgrade for Option<&str> {
        fn upgrade(self) -> Option<String> {
            self.map(|v| v.into())
        }
    }
    
  • Your API Shouldn't Redirect HTTP to HTTPS
  • I disagree.

    You shouldn't serve anything over http. (The article argues that there's risk of leaking user data) Whatever you're using for a webserver should always catch it. A 301/308 redirect is also cached by browsers, so if the mistake is made again, the browser will correct it itself.

    If you make it fail, you're just going to result in user confusion. Did they visit the right website? Is their internet down? etc.

  • Cannot follow @pid_eins@mastodon.social
  • It's not possible to follow Mastodon users on Lemmy yet. It is possible to @ them to a post or comment, they can follow users here, and they can also make posts and comments here after being pinged. (or searching for a post on Mastodon)

  • How can I avoid "value assigned to last is never read" warning from this macro?
  • The issue is related to the binding being reassigned then never used. It's happening because they're using code generation where the final loop doesn't need to assign. (but previous loops use the assignment at the loop start. Just throwing all that in a function and adding the warning suppression fixes it.

    edit: I'm wrong, using an underscore works

    https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2ccac2a848523cb995b6c0efd92c569c

  • How can I avoid "value assigned to last is never read" warning from this macro?
  • I misunderstood the reason the error was showing up. It seems like using a closure fixes it though.

    https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=247730dfc1fbeeb8e2263ea3b95d6c0a

    #[macro_export]
    macro_rules! list {
        () => {
            None
        };
        [ $x:expr, $( $y:expr ),* ] => {{
            #[allow(unused_assignments)]
            let closure = move || {
                let mut first = cons($x, &None);
                let mut last = &mut first;
    
                $(
                    let yet_another = cons($y, &None);
                    if let Some(ref mut last_inner) = last {
                        let last_mut = Rc::get_mut(last_inner).unwrap();
                        last_mut.cdr = yet_another;
    
                        last = &mut last_mut.cdr;
                    }
                )*
    
                first
            };
    
            closure()
        }}
    }
    
  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)V9
    v9CYKjLeia10dZpz88iU @programming.dev
    Posts 2
    Comments 63